FontDialog
Name$ = FontDialog(Name$, Size, [Style])
 
Parameters:

    Name$=the initially selected font
    Size=the initially selected size
    [Style]=the initially selected style
Returns:

    Name$=the seleted font name, Size=the selected size, Style=the selected style
 

     FontDialog opens a Font Dialog. The user can choose a font from all installed and font, specify the size and the style (normal, bold, italic).

Returns the name of the selected font (or a NULL string if the user has cancelled the dialog), the size and the style.

* Name$ = the initially selected font name
* Size = the initially selected font size
* Style = the initially selected font style. This is optional an default to 0 (normal).

There are the following prefdefined constants for the font style
FD_FontStyle_Normal = 0
FD_FontStyle_Bold = 256
FD_FontStyle_Italic = 512
FD_FontStyle_BoldItalic = 512 + 256



FACTS:


     * FontDialog is not asynchronous, so the PlayBasic application will halt while the dialog is open.


  
; Include the Dialogs library in this program
  #Include "PBDialogs2"
  
; Clear the Screen to Blue
  Cls RGB(0,0,255)
  
  
  
; Call the Windows Font Dialog Function.
; Here's we're asking it start with pre-selected
; font (courier) of size 18, with no special flags
  
  Name$,Size,Flags=FontDialog("Courier",15,0)
  
; Check if the USER clicked the cancel button
; while using this dialog ? - If they didn't cancel
; then wahatever they entered we'll accept
  If Name$<>""
     
   ;
     Print "You Selected To Change Fonts To"
     Print Name$
     Print Size
     Print Flags
     
   ; Try and load this font input PlayBasic.
   ;  NOTE: PB can't load all True Type Fonts...
     ThisFont=LoadNewFont(Name$,Size,Flags)
     
   ; Check if the font loaded,
     If GetFontStatus(ThisFont)
        
      ; Set This new font as the current display font
        SetFont ThisFont
        
      ; render some text in the newly loaded font
        Print "This Text Will Be Displayed In The New Font"
        
     EndIf
     
  Else
     Print "You Canceled This Dialog"
     
  EndIf
  
  
  Sync
  WaitKey
  



 
Related Info: :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com